<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<p>整数1：<input type="text" id="one"></p>
	<p>整数2：<input type="text" id="two"></p>
	<button onclick="up(1)" id="t" value="8">相加</button>
	<button onclick="up(2)">相减</button>
	<button onclick="up(3)">相乘</button>
	<button onclick="up(4)">相除</button>
	<p>结果：<input type="text" id="three"></p>
	
	
	<script>
		var t = document.querySelector("#t").value;
		console.log(t);
		function up(n){
			var one = document.querySelector("#one").value;
			one=Number(one);
			var two = document.querySelector("#two").value;
			two=Number(two); 
			if(n==1){
				document.querySelector("#three").value=one+two;
			}
			if(n==2){
				document.querySelector("#three").value=one-two;
			}
			if(n==3){
				document.querySelector("#three").value=one*two;
			}
			if(n==4){
				document.querySelector("#three").value=one/two;
			}
		}
	
	</script>
</body>
</html>